<template>
	<view>
		<!-- 头部导航 -->
		  <uni-nav-bar background-color="#3286ed" rightText="保存" @clickRight="addBtn" :statusBar="true" :fixed='true' color="#fff" :title="formData.id?'修改对账单':'新增对账单'"  left-icon="left"  @clickLeft="backFn" >
		   </uni-nav-bar>
		   <!-- 页面表格 -->
		   <u--form class="form" labelPosition="left" labelWidth="150px" :model="formData" ref="form">
		       <u-form-item @click="openOrderFn" label="对账单编号" prop="number" borderBottom ref="item1">
		           <u--input disabled disabledColor="#fff" v-model="formData.number" border="none"
		               placeholder="对账单编号"></u--input>
		           <u-icon slot="right" name="arrow-right"></u-icon>
		       </u-form-item>
		   	 <u-form-item label="申请时间" prop="applyDate" borderBottom ref="item1">
		   						     <u--input disabled disabledColor="#fff" v-model="formData.applyDate" border="none"
		   						         placeholder="申请时间"></u--input>
		   						     <u-icon slot="right" name="arrow-right"></u-icon>
		   						 </u-form-item>
		   						 <u-form-item label="客户名称" prop="customerName" borderBottom ref="item1">
		   						     <u--input disabled disabledColor="#fff" v-model="formData.customerName" border="none"
		   						         placeholder="客户名称"></u--input>
		   						     <u-icon slot="right" name="arrow-right"></u-icon>
		   						 </u-form-item>
		   						 <u-form-item label="项目名称" prop="projectName" borderBottom ref="item1">
		   						     <u--input disabled disabledColor="#fff" v-model="formData.projectName" border="none"
		   						         placeholder="项目名称"></u--input>
		   						     <u-icon slot="right" name="arrow-right"></u-icon>
		   						 </u-form-item>
		   						 <u-form-item label="关联其他订单" @click="openOrderFn"  borderBottom ref="item1">
		   						     <u--input disabled disabledColor="#fff"   border="none"
		   						         placeholder="关联其他订单"></u--input>
		   						     <u-icon slot="right" name="arrow-right"></u-icon>
		   						 </u-form-item>
		   						 <uni-table border stripe emptyText="暂无更多数据" >
		   						 	<!-- 表头行 -->
		   						 	<uni-tr>
		   						 		<uni-th align="center">序号</uni-th>
		   						 		<uni-th align="center">订单编号</uni-th>
		   								<!-- <uni-th align="center">客户名称</uni-th> -->
		   								<uni-th align="center">项目名称</uni-th>
		   								<!-- <uni-th align="center">项目地址</uni-th> -->
		   								<!-- <uni-th align="center">联系人</uni-th> -->
		   								<!-- <uni-th align="center">联系人电话</uni-th> -->
		   						 		<uni-th align="center">操作</uni-th>
		   						 	</uni-tr>
		   						 	<!-- 表格数据行 -->
		   						 	<uni-tr v-for="(item,index) in formData.statementOrderList">
		   						 		<uni-td align="center">{{index+1}}</uni-td>
		   						 		<uni-td align="center">{{item.orderNo}}</uni-td>
		   						 		<!-- <uni-td align="center">{{item.customerName}}</uni-td> -->
		   								<uni-td align="center">{{item.projectName}}</uni-td>
		   								<!-- <uni-td align="center">{{item.projectAddress}}</uni-td> -->
		   								<!-- <uni-td align="center">{{item.consigneeName}}</uni-td> -->
		   								<!-- <uni-td align="center">{{item.consigneeTel}}</uni-td> -->
		   								<uni-td align="center">
		   									<button type="text" @click="delOrderInfoFn(index)">删除</button>
		   								</uni-td>
		   						 	</uni-tr>
		   						 	 
		   						 
		   						 </uni-table>
		       <u-form-item label="日租金合计" prop="totalDailyRent" borderBottom ref="item1">
		           <u--input disabled disabledColor="#fff" v-model="formData.totalDailyRent"
		               border="none" placeholder="日租金合计"></u--input>
		           <u-icon slot="right" name="arrow-right"></u-icon>
		       </u-form-item>
		      <!-- 应收租金 为机器到货时间-回货申请时间 X 日租金 -->
		       <!-- 租赁机器 -->
		       <u-form-item label="机器应收费用" prop="rentReceivable" borderBottom ref="item1">
		           <u--input disabled disabledColor="#fff" v-model="formData.rentReceivable"
		               border="none" placeholder="机器应收费用"></u--input>
		           <u-icon slot="right" name="arrow-right"></u-icon>
		       </u-form-item>
		       <u-form-item label="对账单附件" prop="accountStatementAttachments" borderBottom ref="item1">
		           <u--input disabled disabledColor="#fff" v-model="formData.accountStatementAttachments"
		               border="none" placeholder="对账单附件"></u--input>
		           <u-icon slot="right" name="arrow-right"></u-icon>
		   			<u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple
		   					:maxCount="10"></u-upload>
		       </u-form-item>
		       <u-form-item label="账户信息附件" prop="returnApplyNo" borderBottom ref="item1">
		           <u--input disabled disabledColor="#fff" v-model="formData.returnApplyNo" border="none"
		               placeholder="账户信息附件"></u--input>
		           <u-icon slot="right" name="arrow-right"></u-icon>
		       </u-form-item>
		    
		       <u-cell customStyle="{'color':'red'}" title="租赁费用明细表" @click="productListFn">
		          
		   							 <template #value>
		   								  <u-icon   slot="right" name="arrow-right"></u-icon>
		   							 </template>
		       </u-cell>
		   						  <uni-table border stripe emptyText="暂无更多数据">
		   							  <!-- 表头行 -->
		   							  <uni-tr>
		   							      <uni-th width="100px" align="center">型号</uni-th>
		   							      <uni-th width="120px" align="center">起租时间</uni-th>
		   							      <uni-th width="120px" align="center">截止时间</uni-th>
		   							      <uni-th width="60px" align="center">天数</uni-th>
		   							      <uni-th width="60px" align="center">数量</uni-th>
		   							      <uni-th width="80px" align="center">日租金</uni-th>
		   								  <uni-th width="100px" align="center">操作</uni-th>
		   							  </uni-tr>
		   							  <uni-tr v-for="(item,index) in statementExpensesList" :key="index">
		   							      <uni-td align="center">
		   									  {{item.model}}
		   								  </uni-td>
		   							      <uni-td align="center" >
		   							           <template slot-scope="scope">
		   										    <view @click="openDate(index,1)">
		   										   <u--input disabled v-model="item.startDate"></u--input>
		   									  		 </view>
		   									   </template>
		   							      </uni-td>
		   							      <uni-td align="center">
		   							           <template slot-scope="scope">
		   							           	<view @click="openDate(index,2)">
		   							           		<u--input disabled v-model="item.endDate"></u--input>
		   							           			</view>
		   							           </template>
		   							      </uni-td>
		   							      <uni-td align="center">{{item.days}}</uni-td>
		   							      <uni-td align="center">
		   									  <template slot-scope="scope">
		   										  <u--input @blur="sumMoney(index)" type="text" v-model="item.quantity"/>
		   									  </template>
		   								  </uni-td>
		   								  <uni-td align="center">
		   								  	<template slot-scope="scope">
		   								  	<u--input @blur="sumMoney(index)" type="text" v-model="item.dailyRent"/>
		   								  	</template>
		   								  </uni-td>
		   							      <uni-td  align="center">
		   							          <button type="warn" size="mini" @click="removeProduct(index)">删除</button>
		   							      </uni-td>
		   							  </uni-tr>
		   						  </uni-table>
		   							 <u-form-item label="机器租赁费合计"   borderBottom ref="item1">
		   							        <u--input disabled disabledColor="#fff" v-model="totalMachineExpense"
		   							            border="none" placeholder="机器租赁费合计"></u--input>
		   							        <u-icon slot="right" name="arrow-right"></u-icon>
		   							    </u-form-item>
		   						   <!-- 包干情况说明 -->
		       <u-cell title="收取客户其他费用明细(业务员填写)" @click="moneyBtn(1)" name="收取客户其他费用">
		           <template #value>
		               <view>添加</view>
		               <uni-icons type="forward" size="24" color="#c3c3c3"></uni-icons>
		           </template>
		       </u-cell>
		       <view>
		           <uni-table border stripe emptyText="暂无更多数据">
		               <!-- 表头行 -->
		               <uni-tr>
		                   <uni-th align="center">序号</uni-th>
		                   <uni-th align="center">费用类别</uni-th>
		                   <uni-th align="center">单位</uni-th>
		                   <uni-th align="center">数量</uni-th>
		                   <uni-th align="center">类别总金额</uni-th>
		                   <uni-th align="center">操作</uni-th>
		   
		               </uni-tr>
		               <!-- 表格数据行 -->
		               <uni-tr v-for="(item,index) in formData.otherExpensesList" :key="index">
		                   <uni-td align="center">{{index+1}}</uni-td>
		                   <uni-td align="center">
		                       <span v-if="item.expenseCategory==1">物流费</span>
		                       <span v-if="item.expenseCategory==2">维修费</span>
		                       <span v-if="item.expenseCategory==0">其他</span>
		                   </uni-td>
		                   <uni-td align="center">
		                       <span v-if="item.unit==0">其他</span>
		                       <span v-if="item.unit==1">台</span>
		                   </uni-td>
		                   <uni-td align="center">{{item.quantity}}</uni-td>
		                   <uni-td align="center">{{item.totalAmount}}</uni-td>
		                   <uni-td align="center">
		                       <button type="warn" size="mini" @click="delHandFn(index,1)">删除</button>
		                   </uni-td>
		               </uni-tr>
		           </uni-table>
		       </view>
		   
		       <u-cell title="其他费用合计">
		           <template #value>
		               <view>{{formData.totalOtherExpenses}}</view>
		           </template>
		       </u-cell>
		       <u-cell title="项目应扣费用明细(业务员填写)" @click="moneyBtn(2)">
		           <template #value>
		               <view>添加</view>
		               <uni-icons type="forward" size="24" color="#c3c3c3"></uni-icons>
		           </template>
		       </u-cell>
		       <view>
		           <uni-table border stripe emptyText="暂无更多数据">
		               <!-- 表头行 -->
		               <uni-tr>
		                   <uni-th align="center">序号</uni-th>
		                   <uni-th align="center">费用类别</uni-th>
		                   <uni-th align="center">单位</uni-th>
		                   <uni-th align="center">金额</uni-th>
		                   <uni-th align="center">是否已支付</uni-th>
		                   <uni-th align="center">支付方</uni-th>
		                   <uni-th align="center">操作</uni-th>
		   
		               </uni-tr>
		               <!-- 表格数据行 -->
		               <uni-tr v-for="(item,index) in formData.deductibleExpensesList" :key="index">
		                   <uni-td align="center">{{index+1}}</uni-td>
		                   <uni-td align="center">
		                       <span v-if="item.expenseCategory==1">物流费</span>
		                       <span v-if="item.expenseCategory==2">维修费</span>
		                       <span v-if="item.expenseCategory==0">其他</span>
		                   </uni-td>
		                   <uni-td align="center">
		                       <span v-if="item.unit==0">其他</span>
		                       <span v-if="item.unit==1">台</span>
		                   </uni-td>
		                   <uni-td align="center">{{item.amount}}</uni-td>
		                   <uni-td align="center">{{item.hasPaid}}</uni-td>
		                   <uni-td align="center">{{item.payer}}</uni-td>
		                   <uni-td align="center">
		                       <button type="warn" size="mini" @click="delHandFn(index,2)">删除</button>
		                   </uni-td>
		               </uni-tr>
		           </uni-table>
		       </view>
		       <u-cell title="应扣费用合计">
		           <template #value>
		               <view>{{formData.totalDeductibleExpenses}}</view>
		           </template>
		       </u-cell>
		       <u-cell title="物流辅料费用明细" @click="moneyBtn(3)">
		           <template #value>
		               <view>添加</view>
		               <uni-icons type="forward" size="24" color="#c3c3c3"></uni-icons>
		           </template>
		       </u-cell>
		       <view>
		           <uni-table border stripe emptyText="暂无更多数据">
		               <!-- 表头行 -->
		               <uni-tr>
		                   <uni-th align="center">序号</uni-th>
		                   <uni-th align="center">费用类别</uni-th>
		                   <uni-th align="center">数量</uni-th>
		                   <uni-th align="center">金额</uni-th>
		                   <uni-th align="center">型号</uni-th>
		                   <uni-th align="center">日期</uni-th>
		                   <uni-th align="center">支付方</uni-th>
		                   <uni-th align="center">操作</uni-th>
		               </uni-tr>
		               <!-- 表格数据行 -->
		               <uni-tr v-for="(item,index) in formData.logisticsExpensesList" :key="index">
		                   <uni-td align="center">{{index+1}}</uni-td>
		                   <uni-td align="center">
		                       <span v-if="item.expenseCategory==1">物流费</span>
		                       <span v-if="item.expenseCategory==2">维修费</span>
		                       <span v-if="item.expenseCategory==0">其他</span>
		                   </uni-td>
		                   <uni-td align="center">{{item.quantity}}</uni-td>
		                   <uni-td align="center">{{item.amount}}</uni-td>
		                   <uni-td align="center">{{item.model}}</uni-td>
		                   <uni-td align="center">{{item.expenseDate}}</uni-td>
		                   <uni-td align="center">{{item.payer}}</uni-td>
		                   <uni-td align="center">
		                       <button type="warn" size="mini" @click="delHandFn(index,3)">删除</button>
		                   </uni-td>
		               </uni-tr>
		           </uni-table>
		       </view>
		       <u-cell title="物流费用合计">
		           <template #value>
		               <view>{{formData.totalLogisticsExpenses}}</view>
		           </template>
		       </u-cell>
		       <u-cell title="维修配件费用明细" @click="moneyBtn(4)">
		           <template #value>
		               <view>添加</view>
		               <uni-icons type="forward" size="24" color="#c3c3c3"></uni-icons>
		           </template>
		       </u-cell>
		       <view>
		           <uni-table border stripe emptyText="暂无更多数据">
		               <!-- 表头行 -->
		               <uni-tr>
		                   <uni-th align="center">序号</uni-th>
		                   <uni-th align="center">费用类别</uni-th>
		                   <uni-th align="center">单位</uni-th>
		                   <uni-th align="center">备注</uni-th>
		                   <uni-th align="center">金额</uni-th>
		                   <uni-th align="center">操作</uni-th>
		   
		               </uni-tr>
		               <!-- 表格数据行 -->
		               <uni-tr v-for="(item,index) in formData.maintenanceCostList" :key="index">
		                   <uni-td align="center">{{index+1}}</uni-td>
		                   <uni-td align="center">
		                       <span v-if="item.expenseCategory==1">物流费</span>
		                       <span v-if="item.expenseCategory==2">维修费</span>
		                       <span v-if="item.expenseCategory==0">其他</span>
		                   </uni-td>
		                   <uni-td align="center">
		                       <span v-if="item.unit==0">其他</span>
		                       <span v-if="item.unit==1">台</span>
		                   </uni-td>
		                   <uni-td align="center">{{item.remark}}</uni-td>
		                   <uni-td align="center">{{item.totalAmount}}</uni-td>
		                   <uni-td align="center">
		                       <button type="warn" size="mini" @click="delHandFn(index,4)">删除</button>
		                   </uni-td>
		               </uni-tr>
		           </uni-table>
		       </view>
		       <u-cell title="维修费用合计">
		           <template #value>
		               <view>{{formData.totalMaintenanceCost}}</view>
		           </template>
		       </u-cell>
		   		 <u-form-item label="租金折让" prop="rentAllowanceAmount" borderBottom ref="item1">
		   						     <u--input   disabledColor="#fff" v-model="formData.rentAllowanceAmount" border="none"
		   						         placeholder="租金折让" @blur="rentMoneyFn"></u--input>
		   						     <u-icon slot="right" name="arrow-right"></u-icon>
		   						 </u-form-item>
		   						 <u-form-item label="折让说明" prop="rentAllowanceAmount" borderBottom ref="item1">
		   						     <u-textarea    disabledColor="#fff" v-model="formData.rentAllowanceDescription" border="none"
		   						         placeholder="折让说明" ></u-textarea>
		   						     <u-icon slot="right" name="arrow-right"></u-icon>
		   						 </u-form-item>
		   						 
		   						 <u-form-item label="已收押金" prop="depositPaid" borderBottom ref="item1">
		   						     <u--input disabled disabledColor="#fff" v-model="formData.depositPaid" border="none"
		   						         placeholder="已收押金"></u--input>
		   						     <u-icon slot="right" name="arrow-right"></u-icon>
		   						 </u-form-item>
		   						 <u-form-item v-if="parseFloat(formData.payAmount)>=parseFloat(formData.depositPaid)" label="未收金额" prop="refundableDeposit" borderBottom ref="item1">
		   						     <u--input   disabledColor="#fff" v-model="formData.uncollected" border="none"
		   						         placeholder="未收金额"></u--input>
		   						     <u-icon slot="right" name="arrow-right"></u-icon>
		   						 </u-form-item>
		   						 <u-form-item   label="应收合计" prop="refundableDeposit" borderBottom ref="item1">
		   						     <u--input   disabledColor="#fff" v-model="formData.payAmount" border="none"
		   						         placeholder="应收合计"></u--input>
		   						     <u-icon slot="right" name="arrow-right"></u-icon>
		   						 </u-form-item>
		   						 
		   						 <u-form-item v-if="parseFloat(formData.payAmount)<=parseFloat(formData.depositPaid)" label="应退押金" prop="refundableDeposit" borderBottom ref="item1">
		   						     <u--input disabled disabledColor="#fff" v-model="formData.refundableDeposit" border="none"
		   						         placeholder="应退押金"></u--input>
		   						     <u-icon slot="right" name="arrow-right"></u-icon>
		   						 </u-form-item>
		   						 <u-form-item v-if="parseFloat(formData.payAmount)<=parseFloat(formData.depositPaid)" label="退款账户名" prop="accountName" borderBottom ref="item1">
		   						     <u--input   disabledColor="#fff" v-model="formData.openingBank" border="none"
		   						         placeholder="退款账户名"></u--input>
		   						     <u-icon slot="right" name="arrow-right"></u-icon>
		   						 </u-form-item>
		   						 <u-form-item v-if="parseFloat(formData.payAmount)<=parseFloat(formData.depositPaid)" label="退款账号" prop="accountNumber" borderBottom ref="item1">
		   						     <u--input   disabledColor="#fff" v-model="formData.accountNumber" border="none"
		   						         placeholder="退款账户"></u--input>
		   						     <u-icon slot="right" name="arrow-right"></u-icon>
		   						 </u-form-item>
		   						 <u-form-item v-if="parseFloat(formData.payAmount)<=parseFloat(formData.depositPaid)" label="开户行名" prop="accountNumber" borderBottom ref="item1">
		   						     <u--input   disabledColor="#fff" v-model="formData.openingBankName" border="none"
		   						         placeholder="开户行"></u--input>
		   						     <u-icon slot="right" name="arrow-right"></u-icon>
		   						 </u-form-item>
		   						 <u-form-item label="账户信息附件" prop="returnApplyNo" borderBottom ref="item1">
		   						     <u--input disabled disabledColor="#fff" v-model="formData.returnApplyNo" border="none"
		   						         placeholder="账户信息附件"></u--input>
		   						     <u-icon slot="right" name="arrow-right"></u-icon>
		   						 </u-form-item>
		   						 <!-- 税率 -->
		   						 <u-form-item   label="税率" prop="taxRatio" borderBottom ref="item1">
		   						     <u--input   disabledColor="#fff" v-model="formData.taxRatio" border="none"
		   						         placeholder="税率" @blur="sumtaxRatio"></u--input>
		   						     <u-icon slot="right" name="arrow-right"></u-icon>
		   						 </u-form-item>
		   						 <u-form-item   label="税费" prop="taxAmount" borderBottom ref="item1">
		   						     <u--input   disabledColor="#fff" v-model="formData.taxAmount" border="none"
		   						         placeholder="税费"></u--input>
		   						     <u-icon slot="right" name="arrow-right"></u-icon>
		   						 </u-form-item>
		   						 <u-form-item   label="项目毛利" prop="estimateProjectProfit" borderBottom ref="item1">
		   						     <u--input   disabledColor="#fff" v-model="formData.estimateProjectProfit" border="none"
		   						         placeholder="项目毛利"></u--input>
		   						     <u-icon slot="right" name="arrow-right"></u-icon>
		   						 </u-form-item>
		   						
		   						 <u-form-item   label="合伙人分成比列" prop="partnerRatio" borderBottom ref="item1">
		   						     <u--input   disabledColor="#fff" v-model="formData.partnerRatio" border="none"
		   						         placeholder="合伙人分成比列" @blur="sumpartnerRatio"></u--input>
		   						     <u-icon slot="right" name="arrow-right"></u-icon>
		   						 </u-form-item>
		   						 <u-form-item   label="合伙人分成金额" prop="partnerAmount" borderBottom ref="item1">
		   						     <u--input   disabledColor="#fff" v-model="formData.partnerAmount" border="none"
		   						         placeholder="合伙人分成金额"></u--input>
		   						     <u-icon slot="right" name="arrow-right"></u-icon>
		   						 </u-form-item>
		   						 </u-form-item><u-form-item   label="项目剩余毛利" prop="residualProjectProfit" borderBottom ref="item1">
		   						     <u--input   disabledColor="#fff" v-model="formData.residualProjectProfit" border="none"
		   						         placeholder="项目剩余毛利"></u--input>
		   						     <u-icon slot="right" name="arrow-right"></u-icon>
		   						 </u-form-item>
		   						 <u-form-item   label="业务员分成比列" prop="salesmanRatio" borderBottom ref="item1">
		   						     <u--input   disabledColor="#fff" v-model="formData.salesmanRatio" border="none"
		   						         placeholder="业务员分成比列" @blur="sumsalesmanRatio"></u--input>
		   						     <u-icon slot="right" name="arrow-right"></u-icon>
		   						 </u-form-item><u-form-item   label="业务员分成金额" prop="salesmanAmount" borderBottom ref="item1">
		   						     <u--input   disabledColor="#fff" v-model="formData.salesmanAmount" border="none"
		   						         placeholder="业务员分成金额"></u--input>
		   						     <u-icon slot="right" name="arrow-right"></u-icon>
		   						 </u-form-item>
		   						 
		   </u--form>
		   <!-- 右侧弹出框 -->
		   <u-popup  :show="show" mode="right" :closeOnClickOverlay="true" @close="show=false" overlayStyle="margin-top:88rpx;" customStyle="margin-top:88rpx;min-width:300px;">
			   <view >
				   <u-cell>
					   <template #title>
						   <view>项目名称</view>
					   </template>
					   <template #value>
							<view  >
								<u-input v-model="orderFormData.projectName" placeholder="请输入项目名称"></u-input>
							</view>
					   </template>
				   </u-cell>
				   <u-cell title="订单状态" @click="orderShow=true">
					   <template #value>
						   <view v-if="orderFormData.orderStatus==0">市场部审批中</view>
						   <view v-if="orderFormData.orderStatus==8">财务部待审批</view>
						   <view v-if="orderFormData.orderStatus==1">待发货</view>
						   <view v-if="orderFormData.orderStatus==7">发货中</view>
						   <view v-if="orderFormData.orderStatus==2">已发货</view>
						   <view v-if="orderFormData.orderStatus==9">申请中</view>
						   <view v-if="orderFormData.orderStatus==3">已申请</view>
						   <view v-if="orderFormData.orderStatus==10">入库中</view>
						   <view v-if="orderFormData.orderStatus==4">已入库</view>
						   <view v-if="orderFormData.orderStatus==5">已对账</view>
						    <view v-if="orderFormData.orderStatus==6">已完结</view>
						   <view v-if="!orderFormData.orderStatus">请选择</view>
						   <view><uni-icons type="forward" size="24"></uni-icons></view>
					   </template>
				   </u-cell>
				   <u-cell>
					   <template #value>
						   <view>
							  <u-button text="查询" @click="searchFn" type="success" size='mini'></u-button>
						   </view>
					   </template>
				   </u-cell>
				   <scroll-view  :scroll-y="true" class="scroll-Y" @scrolltolower="scrolltolower" >
						  <view class="list" v-for="(item,index) in orderList">
							  <view>订单编号：{{item.orderNo}}</view>
							  <view>客户名称:{{item.customerName}}</view>
							  <view>业务员:{{item.salesmanName}}</view>
							  <view>创建时间:{{item.orderDate}}</view>
							  <view class="list-btn"><u-button text="选择" @click="checkedBtn(item)" type="success" size='mini'></u-button></view>
						  </view>
						  <view v-if="this.orderList.length==this.orderTotal  && this.orderList.length!==0">沒有更多了</view>
				  </scroll-view>
			   </view>
		   </u-popup>
		   <!-- 订单的状态 -->
		   
		   <!-- <u-action-sheet :actions="orderStatusList" title="订单状态" @select="selectFn" @close="orderShow=false" :show="orderShow"></u-action-sheet> -->
	       <!-- 起租日期 -->
		   <!-- <u-datetime-picker @close="startDateShow=false"  :show="startDateShow" mode="date" @confirm="confirmFn"></u-datetime-picker> -->
		   <!-- <u-datetime-picker @close="endDateShow=false"  :show="endDateShow" mode="date" @confirm="confirmBtn"></u-datetime-picker> -->
	       <!-- 租金的折让 -->
		   <u-popup  mode="center" :show="inputShow">
			   <view class="popup-box">
			     <view class="title-top">{{name}}</view>
			      <u--input placeholder="请输入内容" fontSize="12px" :clearable="true" border="bottom" v-model="value" ></u--input>
			      <view class="box-bottom">
			   	  <view style="border-right:solid 2px #eee" @click="inputShow=false">取消</view>	
			   	  <view @click="BtnOk">确认</view>	
			      </view>
			   </view>
		   </u-popup>
		   <!-- 右边弹框费用添加 -->
		   <u-popup  :show="moneyShow" mode="right" :closeOnClickOverlay="true" @close="moneyShow=false" overlayStyle="margin-top:88rpx;" customStyle="margin-top:88rpx;min-width:250px;">
		   			<view class="Box" v-if="type==1">
						<u-cell title="费用类别" @click="expenseTypeShow=true" >
							<template #value>
								<view>{{expenseType}}</view>
								<view v-if="!expenseType" style="font-size: 14px;">请选择</view>
							</template>
						</u-cell>
						<u-cell title="单位" @click="expenseUnitShow=true" >
							<template #value>
								<view>{{unit}}</view>
								<view v-if="!unit" style="font-size: 14px;">请选择</view>
							</template>
						</u-cell>
						<view class="little-box">
							<view class="title">数量:</view>
							<u--input  v-model="expensesForm.quantity"   placeholder="请输入内容"></u--input>
						</view>
						<view class="little-box">
							<view class="title">类别总金额:</view>
							<u--input  v-model="expensesForm.totalAmount" placeholder="请输入内容"></u--input>
						</view>
					</view>
					<view class="Box"  v-if="type==2">
						<u-cell title="费用类别" @click="expenseTypeShow=true" >
							<template #value>
								<view>{{expenseType}}</view>
								<view v-if="!expenseType" style="font-size: 14px;">请选择</view>
							</template>
						</u-cell>
						<u-cell title="单位" @click="expenseUnitShow=true" >
							<template #value>
								<view>{{unit}}</view>
								<view v-if="!unit" style="font-size: 14px;">请选择</view>
							</template>
						</u-cell>
						<view class="little-box">
							<view class="title">金额:</view>
							<u--input  v-model="expensesForm.amount"   placeholder="请输入内容"></u--input>
						</view>
						<u-cell title="是否已支付" @click="payShow=true" >
							<template #value>
								<view v-if="expensesForm.hasPaid=='0'">未支付</view>
								<view v-if="expensesForm.hasPaid=='1'">已支付</view>
								<view v-if="!expensesForm.hasPaid" style="font-size: 14px;">请选择</view>
							</template>
						</u-cell>
						
						<view class="little-box">
							<view class="title">支付方:</view>
							<u--input  v-model="expensesForm.payer" placeholder="请输入内容"></u--input>
						</view>
					</view>
					<view class="Box"  v-if="type==3">
						<u-cell title="费用类别" @click="expenseTypeShow=true" >
							<template #value>
								<view>{{expenseType}}</view>
								<view v-if="!expenseType" style="font-size: 14px;">请选择</view>
							</template>
						</u-cell>
						<view class="little-box">
							<view class="title">数量:</view>
							<u--input v-model="expensesForm.quantity"  placeholder="请输入内容"></u--input>
						</view>
						<view class="little-box">
							<view class="title">金额:</view>
							<u--input  v-model="expensesForm.amount"   placeholder="请输入内容"></u--input>
						</view>
						<u-cell title="型号" @click="modelShow=true">
							<template #value>
								<view>{{expensesForm.model}}</view>
								<view v-if="!expensesForm.model" style="font-size: 14px;">请选择</view>
							</template>
						</u-cell>
						<u-cell title="日期" @click="dateBtn">
							<template #value>
								<view>{{expensesForm.expenseDate}}</view>
								<view v-if="!expensesForm.expenseDate" style="font-size: 14px;">请选择</view>
							</template>
						</u-cell>
						<view class="little-box">
							<view class="title">支付方:</view>
							<u--input  v-model="expensesForm.payer" placeholder="请输入内容"></u--input>
						</view>
						<view ><uni-datetime-picker ref="date" v-model="expensesForm.expenseDate" @change="changeFn" /></view>
						
					</view>
					<view class="Box" v-if="type==4">
						<u-cell title="费用类别" @click="expenseTypeShow=true" >
							<template #value>
								<view>{{expenseType}}</view>
								<view v-if="!expenseType" style="font-size: 14px;">请选择</view>
							</template>
						</u-cell>
						<u-cell title="单位" @click="expenseUnitShow=true" >
							<template #value>
								<view>{{unit}}</view>
								<view v-if="!unit" style="font-size: 14px;">请选择</view>
							</template>
						</u-cell>
						<view class="little-box">
							<view class="title">数量:</view>
							<u--input  v-model="expensesForm.quantity"   placeholder="请输入内容"></u--input>
						</view>
						<view class="little-box">
							<view class="title">类别总金额:</view>
							<u--input  v-model="expensesForm.totalAmount" placeholder="请输入内容"></u--input>
						</view>
					</view>
					<view class="btn">
						<view @click="moneyShow=false">取消</view>
						<view @click="submitBtn">确定</view>
					</view>
		   </u-popup>
		   <!-- 关联项目选择框 -->
		    <u-popup :show="orderListShow" mode="right" :closeOnClickOverlay="true" @close="orderListShow=false"
		        overlayStyle="margin-top:88rpx;" customStyle="margin-top:88rpx;min-width:250px;">
		   	 <scroll-view  :scroll-y="true" class="scroll-Y" @scrolltolower="scrolltolower" >
		   	 						  <view class="right-list" v-for="item in OrderListInfo"  @click="checked(item)">
		   	 								<view>订单编号:{{item.orderNo}}</view>
		   	 								<view>客户名称:{{item.customerName}}</view>
		   									<view>项目名:{{item.projectName}}</view>
		   	 								<view>业务员:{{item.salesmanName}}</view>
		   	 								<view>订单创建时间:{{item.orderDate}}</view>
		   	 								<view class="button" >选择</view>
		   	 						  </view>
		   	 						  <!-- <view v-if="this.OrderListInfo.length==this.orderTotal  && this.OrderListInfo.length!==0">沒有更多了</view> -->
		   	 </scroll-view>
		   </u-popup>
		   <!-- 订单状态 -->
		   <u-picker :closeOnClickOverlay="true" :keyName="dictLabel"   :show="orderShow" @confirm="orderstatusconfirm" :columns="orderStatusList" @cancel="orderShow=false"></u-picker>
		   <!-- 选择 -->
		   <u-datetime-picker :show="expectedArrivalDateShow"  v-model="dateNow" @confirm="expectedArrivalDateConfirm" @cancel="expectedArrivalDateShow=false" mode="date"  ></u-datetime-picker>
		   <u-action-sheet :actions="expenseTypeOption" @close="expenseTypeShow=false" @select="selectBtn" title="费用类别" :show="expenseTypeShow"></u-action-sheet>
		   <u-action-sheet :actions="expenseUnitOption" @close="expenseUnitShow=false" @select="selectBtn2" title="费用类别单位" :show="expenseUnitShow"></u-action-sheet>
		   <!-- 是否已支付 -->
		   <u-action-sheet :actions="isPay" @close="payShow=false" @select="selectBtn3" title="是否已支付" :show="payShow"></u-action-sheet>
		   <!-- 型号 -->
		   	<u-picker :closeOnClickOverlay="true"  @close="modelShow=false" :show="modelShow" @confirm="modelConfirm" :columns="modelOption" @cancel="modelShow=false"></u-picker>
	       <!-- 消息提示-->
		   <u-toast ref="uToast"></u-toast>
		   <!-- 提示框 -->
		   	<u-modal showConfirmButton showCancelButton @confirm="BtnModel" @cancel="BtnShow=false" :show="BtnShow" title="提示" content='是否确认提交'></u-modal>
			
	</view>
</template>

<script>
	import {repairListApi } from '@/api/repair.js'
	import {getLogisticsListApi} from '@/api/logistics.js'
	import {addStatementApi,getMachineListExpenseApi,editStatementApi,getStatementInfoApi} from '@/api/accountStatement.js'
	import {selectProductQuantityList} from '@/api/product/product.js'
	import {listOrder} from '@/api/order/order.js'
	import {getDicts} from '@/api/dictionary/index.js'
	import {listCost} from '@/api/enginee.js'
	import {listHouse, listHouse3, outOrderinfo,addOrderApi,editOrderApi,} from '@/api/out/out.js'
	export default {
	      data(){
			  return{
				  formData:{
					contractTemplate: '', //	是	String	合同模板
					sponsor: '', //	是	Long	发起人
					sponsorName: '', //是	string	发起人名称
					salesman: '', //	是	Long	业务员
					salesmanName: '', //	是	string	业务员名称
					applyDate: '', //	是	Date	申请日期
					number: '', //	是	String	编号
					customerId: '', //	是	Long	客户
					customerName: '', //	是	String	客户名称
					businessCompany: '', //	是	string	业务所属公司
					orderId: '', //	是	Long	订单id
					orderNo: '', //	是	string	订单编号
					projectName: '', //	是	string	项目名称
					projectSource: '', //	是	String	项目信息来源
					startDate: '', //是	Date	起租日期
					endDate: '', //	是	Date	到租日期
					usedDays: '', //	是	Long	使用天数
					totalDailyRent: '', //	是	BigDecimal	日租金合计
					rentReceivable: 0, //	是	BigDecimal	应收租金
					rentAllowanceAmount: 0, //	是	BigDecimal	租金折让金额
					rentAllowanceDescription: '', //	是	String	折让说明
					relationApprovalForm: '', //	是	String	关联特殊事项审批单
					totalOtherExpenses: '', //	是	BigDecimal	其他费用总额
					rentPaid: '', //	是	BigDecimal	实收租金
					depositPaid: '', //	是	BigDecimal	实收押金
					refundableDeposit: '', //	是	BigDecimal	应退押金
					accountStatementAttachments: '', //	是	String	对账单附件
					accountNumber: '', //	是	String	帐户信息附件
					totalDeductibleExpenses: '', //	是	BigDecimal	应扣费用总额
					totalLogisticsExpenses: '', //	是	BigDecimal	物流费用总额
					totalMaintenanceCost: '', //	是	BigDecimal	维修费用总额
					estimateProjectProfit: '', //	是	BigDecimal	预估项目毛利
					signRenId: '', //	是	Long	签订人id
					signRenName: '', //	是	String	签订人名称
					collaborator: '', //	是	Long	协同人id
					collaboratorName: '', //	是	String	协同人名称
					otherExpensesList: [], //	是	[]	收取客户其他费用
					deductibleExpensesList: [], //	是	[]	项目应扣费用对象
					logisticsExpensesList: [], //	是	[]	物流及辅料费用对象
					maintenanceCostList: [], //
					statementExpensesList: [] ,//结算费用表
					statementOrderList:[],//关联订单表
					payAmount:0,
					refundableDeposit:0,
					openingBank:'',//开户行名称
					taxAmount:0,//税费
					estimateProjectProfit:0,//项目毛利
					partnerAmount:0,//合伙人分成金额
					salesmanAmount:0//业务员分成金额  
				  },
				  fileList1:[],//上传文件
				  statementExpensesList:[],
				 totalMachineExpense:0.,
				 show:false,
				 orderList:[],
				 orderShow:false,
				 orderFormData:{
					 orderStatus:4,
					 projectName:'',
				 },//选择订单
				 OrderListInfo:[],//关联对账单
				 orderStatusList:[],//订单状态
				 statementExpensesList:[],
				 outProductListInfo:[],//出库产品
				 businessCompanyOptions:[],
				 projectSourceOptions:[],
				 dateNow:'',
				 expensesForm:{
					 expenseCategory: '',
					 unit: '',
					 // quantity:'',
					 // totalAmount:'',
					 hasPaid: '',
					 expenseDate: '',
					 model: '',
				 },//费用表单
				 modelShow:false,
				 modelOption:[],//型号
				 payShow:false,//支付方
				 inputShow:false,//输入框
				 expenseTypeShow:false,//费用类别
				 expenseTypeOption:[],
				 expenseUnitShow:false,//单位
				 expenseUnitOption:[],
				 payShow:false,//是否已支付
				 isPay:[],
				 expectedArrivalDateShow:false,
				 BtnShow:false,
				 orderListShow:false,
				 type:1,
				 moneyShow:false 
				 
			  }
		  },
		  onLoad(e) {
			  if(JSON.stringify(e)!=="{}"){
				  this.getstatementInfo(e)
			  }
		     
		  },
		  created() {
		  	this.getorderStatusoptions()
		  },
		  methods:{
			  async getstatementInfo(e){
				  let res=await getStatementInfoApi(e.id)
				  this.formData=res.data
				  let accountStatementAttachments="http://101.132.141.5:8081"+res.data.accountStatementAttachments
				  this.fileList1.push({url:accountStatementAttachments})
			  },
			  // 选择订单
			  async openOrderFn(){
				 this.show=true 
				 let res=await listOrder(this.orderFormData)
				 this.orderList=res.rows
			  },
			  // 选择
			   async checkedBtn(item) {
				   this.show=false
				   // 获取出库单
				   let value=await listHouse({orderNo: item.orderNo}) 
				   let value2=await listHouse3({id:value.rows[0].id})
				   this.outProductListInfo=value2.rows
			  	 //根据到货日期和扫码入库日期计算应收租金
			  	 let arr=[]
			  this.outProductListInfo.forEach(item=>{
			  	arr.push(...item.machineList)
			  })
			  let days=0
			  let moneys=0
			  arr.forEach(items=>{
			  	 days=this.getDayBetween(items.logisticsTime,items.warehouseTime)
			  	  moneys+=days*items.dailyRent
			  	  console.log(moneys,days, items,'租赁费');
			  	  // console.log(this.formData.rentReceivable);
			  })
			    this.formData.rentReceivable=moneys
			     this.dateNow=this.getNowTime()
			      
			       
			        
			  		 // 如果包干金额存在
			  		 if(item.lumpAmount!==0||item.lumpAmount!==""||item.lumpAmount!==null){
			  			 this.totalMachineExpense=item.lumpAmount
			  		 }
			           this.formData.number = this.setStatementNo()
			  		 
			           this.formData.contractTemplate = item.contractTemplate
			           this.formData.sponsor = item.sponsor
			           this.formData.sponsorName = item.sponsorName
			           this.formData.signRenId = item.salesman
			           this.formData.signRenName = item.salesmanName
			           this.formData.salesman = item.salesman
			           this.formData.salesmanName = item.salesmanName
			           this.formData.applyDate = item.createTime
			           this.formData.customerId = item.customerId
			           this.formData.customerName = item.customerName
			           this.formData.businessCompany = item.businessCompany
			           this.formData.orderId = item.id
			           this.formData.orderNo = item.orderNo
			           this.formData.projectName = item.projectName
			           this.formData.projectSource = item.projectSource
			           this.formData.totalDailyRent = item.totalDailyRent
			           // this.formData.rentReceivable = item.totalRant
			           this.formData.collaborator = item.collaborator
			           this.formData.collaboratorName = item.collaboratorName
			           this.formData.depositPaid = item.receivedAmount
			           this.businessCompany = this.getValue(this.businessCompanyOptions, item.businessCompany)
			           this.projectSource = this.getValue(this.projectSourceOptions, item.projectSource)
			           // 获取物流的费用表单
			           const res1 = await getLogisticsListApi({
			               orderId: item.id
			           })
			           res1.rows.forEach((item) => {
			               let newItem = {}
			               if (item.createTime) {
			                   newItem.date = item.createTime
			                   delete item.createTime
			               }
			               if (item.logisticsExpenses) {
			                   newItem.amount = item.logisticsExpenses
			                   delete item.logisticsExpenses
			               }
			               newItem.expenseCategory = 1
			               newItem.orderId = null
			               newItem.orderType = 1
			               newItem.quantity = null
			               newItem.model = null
			               newItem.payer = null
			  
			               this.formData.logisticsExpensesList.push(newItem)
			  
			           })
			           // this.expenseType=this.getValu2(this.expenseTypeOption,1)
			           this.formData.totalLogisticsExpenses = 0
			           this.formData.logisticsExpensesList.forEach(item => {
			               this.formData.totalLogisticsExpenses += Number(item.amount)
			           })
			  
			           // 获取维修的费用
			           const res2 = await repairListApi({
			               orderId: item.id
			           })
			           res2.rows.forEach((item, index) => {
			               let newItem = {}
			               if (item.repairAmount) {
			                   newItem.totalAmount = item.repairAmount
			               }
			               if (item.repairDescription) {
			                   newItem.remark = item.repairDescription
			                   delete item.repairDescription
			               }
			               newItem.expenseCategory = 2
			               newItem.orderId = null
			               newItem.orderType = 1
			               newItem.unit = null
			               this.formData.maintenanceCostList.push(newItem)
			           })
			  
			           // this.expenseType=this.getValu2(this.expenseTypeOption,1)
			           this.formData.totalMaintenanceCost = 0
			           this.formData.maintenanceCostList.forEach(item => {
			               this.formData.totalMaintenanceCost += Number(item.totalAmount)
			           })
			           // 工程费获取/放在项目其项目应扣费用
			           let res4 = await listCost({
			               orderNo: item.orderNo
			           })
			           res4.rows.forEach(item => {
			               let newItem = {}
			               if (item.days) {
			                   newItem.quantity = item.days
			               }
			               if (item.costs) {
			                   newItem.totalAmount = item.costs
			               }
			               newItem.expenseCategory = 3
			               newItem.orderType = 1
			               newItem.unit = 2
			               this.formData.otherExpensesList.push(newItem)
			           })
			           this.formData.totalOtherExpenses = 0
			           this.formData.otherExpensesList.forEach(item => {
			               this.formData.totalOtherExpenses += Number(item.totalAmount)
			           })
			  
			           // 应该收租金
			           this.formData.payAmount = 0
			           this.formData.payAmount += Number(this.totalMachineExpense) + Number(this
			                   .formData.totalOtherExpenses)  
			  			 // 应退押金=已收押金-应收合计
			  			 this.formData.refundableDeposit=0
			  			 this.formData.refundableDeposit=Number(this.formData.depositPaid)-Number(this.formData.payAmount)
			  			 console.log(this.formData.refundableDeposit,'ui');
			  			 // 未收金额=应收合计-已收押金
			  			 	this.formData.uncollected=0
			  			 	this.formData.uncollected=Number(this.formData.payAmount)-Number(this.formData.depositPaid)
			  		
			   },
			   getValue(arr, item) {
			       for (var i = 0; i < arr.length; i++) {
			           if (item == arr[i].dictValue) {
			               return arr[i].dictLabel
			           }
			       }
			   },
			  // 计算日租金
			  setDailyTotalRent(index) {
			  
			      //计算日租金
			      let total = 0
			      let arr = []
			  				 if(this.statementExpensesList.length==0){
			  					 this.totalMachineExpense=0
			  				 }
			      this.statementExpensesList.forEach((item, index) => {
			          if (item.quantity && item.dailyRent) {
			              total = parseFloat(item.quantity) * parseFloat(item.dailyRent) * parseFloat(item.days);
			              arr.push(total)
			          } 
			          // console.log(arr)
			          let sum = arr.reduce(function(prev, cur, index) {
			              return prev + cur;
			          })
			          // console.log(sum)
			          this.totalMachineExpense = sum
			  
			      })
			  
			     // 应该收租金
			     this.formData.payAmount = 0
			     this.formData.payAmount += Number(this.totalMachineExpense) + Number(this
			             .formData.totalOtherExpenses)
			  						
			     	// 应退押金=已收押金-应收合计
			     	this.formData.refundableDeposit=0
			     	this.formData.refundableDeposit=Number(this.formData.depositPaid)-Number(this.formData.payAmount)
			     	console.log(this.formData.refundableDeposit,'ui');
			     	// 未收金额=应收合计-已收押金
			     		this.formData.uncollected=0
			     		this.formData.uncollected=Number(this.formData.payAmount)-Number(this.formData.depositPaid)
			    // 税费=应收合计X税率
			    this.formData.taxAmount=0
			    this.formData.taxAmount=Number(this.formData.payAmount)*parseFloat(this.formData.taxRatio)*0.01
			    this.formData.taxAmount=this.getmathtwo(this.formData.taxAmount)
			    // 项目毛利=应收合计-项目应扣费用-物流辅料费用-维修配件费用-税费
			    this.formData.estimateProjectProfit=0
			    this.formData.estimateProjectProfit=Number(this.formData.payAmount)-Number(this.formData.totalDeductibleExpenses) - Number(this.formData.totalLogisticsExpenses) -Number(this.formData.totalMaintenanceCost)-Number(this.formData.taxAmount)
			    this.formData.estimateProjectProfit=this.getmathtwo(this.formData.estimateProjectProfit)
			    // 合伙人分成金额=项目毛利X合伙人分成比列
			    this.formData.partnerAmount=0
			    this.formData.partnerAmount=Number(this.formData.estimateProjectProfit)*parseFloat(this.formData.partnerRatio)*0.01
			    this.formData.partnerAmount=this.getmathtwo(this.formData.partnerAmount)
			    // 项目剩余毛利
			    this.formData.residualProjectProfit=0
			    this.formData.residualProjectProfit=Number(this.formData.estimateProjectProfit)-Number(this.formData.partnerAmount)
			    this.formData.residualProjectProfit=this.getmathtwo(this.formData.residualProjectProfit)
			    // 业务员提成金额=项目剩余毛利*提成比列
			    this.formData.salesmanAmount=0
			    this.formData.salesmanAmount=Number(this.formData.residualProjectProfit)*parseFloat(this.formData.salesmanRatio)*0.01
			    this.formData.salesmanAmount=this.getmathtwo(this.formData.salesmanAmount)			
			    				
			  },
			  // 费用明细聊表添加
			  moneyBtn(item) {
			      console.log(item);
			      this.type = item
			      // this.expenseCategory
			      if (item == 1) {
			          this.expensesForm = {
			              expenseCategory: '',
			              unit: '',
			              quantity: '',
			              totalAmount: '',
			          } //费用表单
			      }
			      if (item == 2) {
			          this.expensesForm = {
			              expenseCategory: '',
			              unit: '',
			              hasPaid: '',
			              amount: '',
			              payer: ''
			          }
			      }
			      if (item == 3) {
			          this.expensesForm = {
			              expenseCategory: '',
			              quantity: '',
			              amount: '',
			              model: '',
			              expenseDate: '',
			              payer: '',
			          }
			      }
			      if (item == 4) {
			          this.expensesForm = {
			              expenseCategory: '',
			              unit: '',
			              quantity: '',
			              totalAmount: '',
			          }
			      }
			      this.moneyShow = true
			  },
			  // 生成对账单编号
			  setStatementNo() {
			      var date = new Date();
			      var year = date.getFullYear(); //年 ,从 Date 对象以四位数字返回年份
			      var month = date.getMonth() + 1; //月 ,从 Date 对象返回月份 (0 ~ 11) ,date.getMonth()比实际月份少 1 个月
			      var day = date.getDate(); //日 ,从 Date 对象返回一个月中的某一天 (1 ~ 31)
			      //修改月份格式
			      if (month >= 1 && month <= 9) {
			          month = "0" + month;
			      }
			      //修改日期格式
			      if (day >= 0 && day <= 9) {
			          day = "0" + day;
			      }
			  
			      let round = Math.floor(Math.random() * (999 - 100)) + 100;
			      var currentFormatDate = `${year}${month}${day}`;
			      return "DZ" + currentFormatDate + round;
			  },
			  // 取两位小数
			  getmathtwo(val){
			  				 return Math.floor(val*100)/100
			  				 
			  },
			  // 获取当前时间
			  getNowTime(){
			  		var date= new Date()
			  		var month = date.getMonth() + 1;
			  		var time = date.getFullYear() + "-" + month + "-" + date.getDate();
			  		return time;},
			  orderstatusconfirm(e){
				  this.orderShow=false
				  this.orderFormData.orderStatus=e.value[0].dictValue
			  },
			  // 计算天数
			  getDayBetween(start,end){
			   var startDate=Date.parse(start)
			    var endDate=Date.parse(end)
			    if(startDate>endDate){
			      return his.$refs.uToast.show({
			  						 type:"error",
			  						 message:'请重新选择日期'
			  					 }) 
			    }
			    if(startDate==endDate){
			      return 1
			    }
			    var days=(endDate-startDate)/(1*24*60*60*1000)
			    return days
			  },
			  //格式转换
			  formatDate(d) {
			      var date = new Date(d);
			      var YY = date.getFullYear() + '-';
			      var MM =
			          (date.getMonth() + 1 < 10 ?
			              '0' + (date.getMonth() + 1) :
			              date.getMonth() + 1) + '-';
			      var DD = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
			  
			      return YY + MM + DD
			  },
			  // 获取型号
			  getModel(){
			  	let newArr=[]
			  	selectProductQuantityList({pageNum:1,pageSum:1000}).then(response=>{
			  		console.log(response);
			  		response.rows.forEach((item)=>{
			                  newArr.push(item.model)
			  		})
			  		this.modelOption.push(newArr)
			  	})
			  },
			  // 获取订单状态
			  async getorderStatusoptions(){
				  let res=await getDicts('order_type')
				  this.orderStatusList.push(res.data)
			  },
			  // 业务所属公司
			  getBusinessCompany() {
			      getDicts('biz_business_company').then(response => {
			          this.businessCompanyOptions = response.data
			      })
			  },
			  backFn(){
				  uni.navigateBack({delta:1})
			  }
		  }
		  
	}
</script>

<style lang="scss">
	.popup-box{
		min-width: 250px;
		min-height: 100px;
		text-align: center;
		
		.title-top{
			height:40px;
			line-height: 40px;
			font-size: 16px;
			font-weight: 600;
		}
		.box-bottom{
			display: flex;
			justify-content: space-around;
			height:40px;
			line-height: 40px;
			view{
				width:50%;
			}
		}
	}
	.list{
		position: relative;
		padding: 10px;
		border: solid 1px #c3c3c3;
		font-size: 12px;
		.list-btn{
			position: absolute;
			right:20px;
			bottom: 10px;
		}
	}
    .Box{
		.little-box{
			padding: 10px;
			border-bottom: solid 1px #c3c3c3;
			.title{
				font-size: 16px;
				margin-bottom: 5px;
			}
		}
		
	}
	.btn{
		width: 100%;
		min-height: 40px;
		line-height:40px;
		// margin-top: 25px;
		border: solid 1px #c3c3c3;
		display: flex;
		justify-content: space-evenly;
	}
	.form {
	    background-color: #fff;
	    padding-left: 10px;
	    padding-right: 10px;
	
	    .box {
	        height: 200px;
	
	        .boxTop {
	            width: 100%;
	            height: 30px;
	            display: flex;
	            justify-content: space-between;
	        }
	
	        .boxValue {
	            width: 100%;
	            display: flex;
	            justify-content: space-between;
	        }
	    }
	
	}
</style>
